import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;


/**
 * @author Sai
 * Created by Sai on 2019-03-03.
 */
@WebServlet(urlPatterns = {"/login/dgut"})
public class LoginServlet extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws  IOException {
        LoginController loginController=new LoginController();
        Map<String,String> userinfo = new HashMap<String,String>();
        userinfo = loginController.login(request,response);
        for(Map.Entry<String,String> entry : userinfo.entrySet()){
            request.getSession().setAttribute(entry.getKey(),entry.getValue());
        }
        response.sendRedirect("/Loginnn.jsp");
    }
}
